package com.lighthouse.base.common.dao;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import com.ibatis.sqlmap.client.SqlMapClient;


@Repository("generalDao")
public class generalDAO extends SqlMapClientDaoSupport {
	protected generalDAO() {
		
	}
	
    @Resource(name = "sqlMapClient")
    public void setSuperSqlMapClient(SqlMapClient sqlMapClient) {
        super.setSqlMapClient(sqlMapClient);
    }
    
    public Object insert(String queryId, Object parameterObject) {
        return getSqlMapClientTemplate().insert(queryId, parameterObject);
    }
    
    public int update(String queryId, Object parameterObject) {
        return getSqlMapClientTemplate().update(queryId, parameterObject);
    }
    
    public int delete(String queryId, Object parameterObject) {
        return getSqlMapClientTemplate().delete(queryId, parameterObject);
    }
    
    @SuppressWarnings("rawtypes")
	public List select(String queryId, Object parameterObject) {
        return getSqlMapClientTemplate().queryForList(queryId, parameterObject);
    }
    
	public int getCount(String queryId, Object parameterObject) {
        return (Integer)getSqlMapClientTemplate().queryForObject(queryId, parameterObject);
    }

    public Object getObject(String queryId, Object parameterObject) {
        return getSqlMapClientTemplate().queryForObject(queryId, parameterObject);
    }
    
/*
    public void startTransaction() throws SQLException {
        //this.startTransaction();
    }

    public void commitTransaction() throws SQLException {
        //this.commitTransaction();
    }

    public void endTransaction() throws SQLException {
        //this.endTransaction();
    }
*/
}